package org.chen.ly.config;// OllamaEmbeddingConfig.java

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.time.Duration;

@Configuration
public class OllamaEmbeddingConfig {

    @Value("${ollama.embedding.timeout:30}")
    private int timeoutSeconds;

    @Bean("ollamaRestTemplate")
    public RestTemplate ollamaRestTemplate() {
        return new RestTemplateBuilder()
                .setConnectTimeout(Duration.ofSeconds(timeoutSeconds))
                .setReadTimeout(Duration.ofSeconds(timeoutSeconds))
                .build();
    }
}